bca. inpadi GMS Guide to jobs and scripts

This is a guide to write job and scripts in inpadi GMS.
inpadi GMS handeling and execution are based on the scripts extention (.que or .DB) of further naming see - "bba. GMS Core Server Side".
 
Depending on what OS the inpadi Agent is running, the scripts need to be written for that os!
On Windows we execute scripts as CMD scripts and are written with CrLf \r\n as newline.
On Linux and OSX we execute it as a BASH script are written wirh Lf \n as newline.

We will not cover scripting on Linux further here - but the buildin script functions clientfile= and neededfile= is the same for all OS.
maxruntime= sets the maxumum runtime that a script must run. maxruntime=5 kills the script after 5 minutes.

If you have another script language you would like to use, you can always upload a script to the client folder in GMS og _Software folder if it must be available to several systems and downlod it to the client with clientfile=scriptname - fx. clientfile=joindomain.ps1.
A powershell script can by the way be executed with: @powershell -ExecutionPolicy unrestricted -File "myscript.ps1"

If you have a small file you would like to transfer to DoneJob folder on inpadi GMS server from the client, you can from a script echo following to screen: echo upload::filename - please only try to upload small files <10MB as it's quite memory intenssive for the client to process. It CANNOT be used for backup of client files - there are other GMS functions for that.

When running the same script repeadtedly or scheduled - its stronly recomended to reference a "master" script. This is done by using "ScriptRef=" and then the name of the script. The script you refer to must be placed in the client folder or in the "_Software" folder as it's the client that downloads the script and embedding it.
By using "ScriptRef" future changes can be made to the master script avoiding the task to edit job for all involved clients.
 
Special commands - Entered in the "Job Editors" name field and saved
delete.srv - Executed on af selected client will move it " _Graveyard" folder - If the client comes online again it will restore the client from "_Graveyard".
mkdir:: - Execute to create a new profile profile in ReInstall - Select og enter ReInstall folder and  save jobname "mkdir::NewProfile".
.profile - Associate a client with at profile - just select or enter client(s) and save a empty job with "profilename.profile".
 
Default job script
::Title=Default job description - This description must be first line!
# Remove # to activate function!
#Server backend instructions (GMS Server)
#pkg:Success= //A text string found in script output
#pkg:RetryCount= //Set a number of package retry
#pkg:MailError= //If not pgk:Success is forfilled by package output send error to email address

#Packange actions to client (GMS Client)
#JobID= //Job name - a very good idea for scheduled jobs!
#NeededFile= //http url to internet resource
#ClientFile= //file on GMS server in the client folder or in _Software folder
#maxruntime= //Script max runtime - must be written as fx. 10s for 10 seconds or 5m for 5 minutes etc. 
#Script commands to to do stuff on backend (From GMS Client script to GMS Server)
#echo notifymail:: //Mail address to send joblog to.
#echo pausemonitor:: //Pause server monitoring for X minutes.